package cn.wolfcode.luowowo.article.query;

import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;
@Getter
@Setter
public class TravelCondition {
    //在jvm启动的时候,只加载一次,因为map是静态的常量,在类加载的时候创建,所以map中的参数要在
    //静态的代码块中创建
    public static final Map <String, TravelCondition> orderMap = new HashMap();
    public static final Map <String, TravelCondition> travelTimeMap = new HashMap();
    public static final Map <String, TravelCondition> perExpendMap = new HashMap();
    public static final Map <String, TravelCondition> dayMap = new HashMap();
    private int min;
    private int max;

    public TravelCondition(int min, int max) {
        this.min = min;
        this.max = max;
    }

    static {
        //时间
        dayMap.put( "-1", null );
        dayMap.put( "1", new TravelCondition( 1, 3 ) );
        dayMap.put( "2", new TravelCondition( 4, 7 ) );
        dayMap.put( "3", new TravelCondition( 8, 14 ) );
        dayMap.put( "4", new TravelCondition( 15, Integer.MAX_VALUE ) );
        //最低消费
        perExpendMap.put( "-1", null );
        perExpendMap.put( "1", new TravelCondition( 1, 999 ) );
        perExpendMap.put( "2", new TravelCondition( 1000, 6000 ) );
        perExpendMap.put( "3", new TravelCondition( 6000, 20000 ) );
        perExpendMap.put( "4", new TravelCondition( 20000, Integer.MAX_VALUE ) );
        //出发时间
        travelTimeMap.put( "-1", null );
        travelTimeMap.put( "1", new TravelCondition( 1, 2 ) );
        travelTimeMap.put( "2", new TravelCondition( 3, 4 ) );
        travelTimeMap.put( "3", new TravelCondition( 5, 6 ) );
        travelTimeMap.put( "4", new TravelCondition( 7, 8 ) );
        travelTimeMap.put( "5", new TravelCondition( 9, 10 ) );
        travelTimeMap.put( "6", new TravelCondition( 11, 12 ) );
    }
}

